<template>
{{#if page.psSysPFPlugin}}
    {{> @macro/plugins/view/view-use.hbs appPlugin=page.psSysPFPlugin}}
{{else}}
    {{#if page.psViewLayoutPanel.useDefaultLayout}}
    <AppIndexViewLayout
      :mainMenuAlign="model.mainMenuAlign" :class="classNames">
{{#neq page.mainMenuAlign 'NONE'}}
{{#page.ctrls}}
    {{#eq controlType 'APPMENU'}}
        <template #default>
          {{> @macro/widgets/appmenu-detail/appmenu.hbs ctrl=ctrl}}
        </template>
    {{/eq}}
{{/page.ctrls}}
{{/neq}}
        <template #navPos>
            <AppNavPos></AppNavPos>
        </template>
        {{> @macro/view/view-msg.hbs}}  
    </AppIndexViewLayout>
    {{else}}
    <div :class="classNames">
        {{#if page.psViewLayoutPanel.rootPSPanelItems}}
        {{#each page.psViewLayoutPanel.rootPSPanelItems as | panelItem |}}
        {{> @macro/widgets/panel-detail/include-panel.hbs type=panelItem.itemType item=panelItem isMultiData=false panel=page.psViewLayoutPanel page=page}}
        {{/each}}
        {{/if}}
    </div>
    {{/if}}
{{/if}}
</template>
<script setup lang="ts">
{{#if page.psViewLayoutPanel.viewProxyMode}}
{{> @macro/widgets/ctrl/import-ctrl.hbs ctrls=page.psViewLayoutPanel.psControls}}
{{else}}
{{/if}}
import { AppCtrlPos, AppScrollContainer, AppSimpleFlexContainer, AppStandardContainer, AppTabPanel, AppTabPage } from '@components/layout-element/structure';
import { AppIndexViewLayout } from "@components/layout/index-view-layout";
{{> @macro/widgets/ctrl/import-ctrl.hbs ctrls=page.ctrls appEntity=appEntity}}
import { model } from "./{{spinalCase page.codeName}}-model";
import { getIndexViewClassNames, handleCtrlInit, handleCtrlAction, handleCtrlDestroy, useNavParamsBind, useEventBind } from '@/hooks/use-view';
import { IIndexViewAbility, IIndexViewController,IIndexViewControllerParams, IIndexViewStore, IndexViewActionType, IndexViewController, IParam, ILoadingHelper, IContext } from "@/core";

{{> @macro/view/view-props.hbs}}

{{> @macro/common/emit.hbs name="view" actionType="IndexViewActionType" ability="IIndexViewAbility"}}

const classNames = computed(() => {
  return getIndexViewClassNames(model, props);
});

const params: IIndexViewControllerParams<IndexViewActionType, IIndexViewAbility> = { model, evt, openType:props.openType, pLoadingHelper:props.pLoadingHelper, handler: (data: IIndexViewStore) => { return reactive(data); } };

{{> @macro/common/controller.hbs name="view" IController="IIndexViewController" store="IIndexViewStore" ability="IIndexViewAbility" controller="IndexViewController"}}
</script>